package redis

import (
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
	"short-video-media/common/models/mysql"
	"short-video-media/common/nacos"
)

var Rdb *redis.Client

func InitRedis() {
	nac := nacos.NacosConfig.Redis
	Rdb = redis.NewClient(&redis.Options{
		Addr:     nac.Addr,
		Password: nac.Password, // no password set
		DB:       nac.Db,       // use default DB
	})
	fmt.Println("redis连接成功")
}
func WorkToRedis(key string, items *mysql.Works) {
	Rdb.HSet(context.Background(), key, items.ID, items)
}
